package com.chiv.ribbon.service.impl;

import com.chiv.ribbon.entity.Person;
import com.chiv.ribbon.service.PersonService;
import org.springframework.core.env.Environment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class PersonServiceImpl implements PersonService {

    private Logger LOGGER = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private Environment environment;

    @Override
    public Object getList() {
        LOGGER.info("environment:" + environment.getActiveProfiles()[0]);
        List<Person> list = new ArrayList<>();
        list.add(new Person("小马", 20));
        list.add(new Person("小红", 20));
        return list;
    }
}
